{% extends 'base.html' %}

{% block extra_css %}
<style>
    .register-container {
        background-image: url("/static/images/register-bg.jpg");
        background-size: cover;
        background-position: center;
        min-height: 100vh;
        display: flex;
        align-items: center;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .register-box {
        background: rgba(255, 255, 255, 0.95);
        padding: 30px;
        border-radius: 10px;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
    .form-control:focus {
        border-color: #0d6efd;
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    }
    .form-label {
        font-weight: 500;
    }
    .btn-primary {
        padding: 12px 30px;
        font-weight: 500;
    }
    .form-check-label a {
        color: #0d6efd;
        text-decoration: none;
    }
    .form-check-label a:hover {
        text-decoration: underline;
    }
</style>
{% endblock %}

{% block content %}
<div class="register-container">
    <div class="container">
        <div class="row">
            <div class="col-md-6 mx-auto">
                <div class="register-box">
                    <h2 class="text-center mb-4">注册</h2>
                    {% if messages %}
                        {% for message in messages %}
                            <div class="alert alert-{{ message.tags }} alert-dismissible fade show">
                                {{ message }}
                                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                            </div>
                        {% endfor %}
                    {% endif %}
                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-4">
                            <label for="id_phone" class="form-label">手机号</label>
                            <div class="input-group">
                                <span class="input-group-text">+</span>
                                <input type="tel" class="form-control" id="id_phone" name="phone" required
                                       placeholder="请输入手机号">
                            </div>
                        </div>
                        <label for="id_nickname" class="form-label">昵称</label>
                        <div class="input-group">
                            <input type="tel" class="form-control" id="id_nickname" name="nickname" required
                                   placeholder="请输入昵称">
                        </div>

                        <div class="mb-4">
                            <label for="id_id_card" class="form-label">身份证号</label>
                            <input type="text" class="form-control" id="id_id_card" name="id_card" maxlength="18"
                                   placeholder="请输入18位身份证号">
                            <div class="form-text text-muted">请输入18位身份证号，用于实名认证</div>
                        </div>
                        <div class="mb-4">
                            <label for="id_password1" class="form-label">密码</label>
                            <input type="password" class="form-control" id="id_password1" name="password1" required
                                   placeholder="请输入密码">
                        </div>
                        <div class="mb-4">
                            <label for="id_password2" class="form-label">确认密码</label>
                            <input type="password" class="form-control" id="id_password2" name="password2" required
                                   placeholder="请再次输入密码">
                        </div>
                        <div class="form-check mb-3">
                            <input class="form-check-input" type="checkbox" id="remember" name="remember">
                            <label class="form-check-label" for="remember">
                                记住我
                            </label>
                        </div>
                        <div class="form-check mb-4">
                            <input class="form-check-input" type="checkbox" id="agree_privacy" name="agree_privacy" required>
                            <label class="form-check-label" for="agree_privacy">
                                我已阅读并同意<a href="{% url 'user_agreement' %}" target="_blank">用户协议</a>
                            </label>
                        </div>
                        <div class="d-grid mb-4">
                            <button type="submit" class="btn btn-primary btn-lg">注册</button>
                        </div>
                        <div class="text-center">
                            <a href="{% url 'login' %}" class="text-decoration-none">
                                已有账号？立即登录
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
